package com.yc.project1.aspects;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

/**
 * @author zwei
 * @create 2024-08-04 16:19
 */
@Aspect
@Component
//@Order(100000)
public class OneAspect implements Ordered {
    @Pointcut("execution(* com.yc.project1.service.*.show*(..))")
    private void a(){}
    @Around("a()")
    public Object around(ProceedingJoinPoint pjp){
        System.out.println("oneAspect进来了");
        Object obj=null;
        try {
            obj=pjp.proceed();
        }catch (Throwable e){
            throw new RuntimeException(e);
        }
        System.out.println("oneAspect出去了");
        return obj;
    }
    @Override
    public int getOrder() {
        return 100000;      //数字越大  优先级越低
    }
}
